package com.lovo.project2.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lovo.project2.bean.ClientBean;
import com.lovo.project2.bean.SuppilerBean;
import com.lovo.project2.service.IClientBeanService;
import com.lovo.project2.service.ISuppilerBeanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/client")
public class ClientBeanController {

    @Autowired
    IClientBeanService iSuppilerBeanService;

    @RequestMapping("queryall")
    IPage<ClientBean> queryAll(int pg, int pgsize, String supName, String rangle){
        IPage iPage=new Page(pg,pgsize);
        return iSuppilerBeanService.queryListBynameByscope(iPage,supName,rangle);
    }

    @RequestMapping("querySuById")
    ClientBean querySuById(int id){

        return iSuppilerBeanService.queryClientBeanById(id);
    }

    @RequestMapping("updateSupp")
    String updateSupp(@RequestBody ClientBean clientBean)  {
        iSuppilerBeanService.updateClientBean(clientBean);

        return "ok";
    }

    @RequestMapping("addSupp")
    String addSupp(@RequestBody ClientBean clientBean){

        iSuppilerBeanService.addClientBean(clientBean);

        return "ok";
    }



}
